﻿<div class="modal" tabindex="-1"  data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog"   style=" width: 800px;">
        <div class="modal-content">
            <form name="userForm" novalidate>
                <div class="modal-header">
                    <!--<button type="button" class="close" ng-click="close(false)" data-dismiss="modal"-->
                            <!--aria-hidden="true">&times;</button>-->
                    <h4 class="modal-title">&nbsp;{{modalTitle}}&nbsp;</h4>
                </div>
                <div class="modal-body">
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-xs-2 text-left">
                                <label>客户编号</label>
                            </div>
                            <div style="margin-left: -20px;margin-top: -8px;" class="col-xs-4">
                                <input type="text" class="form-control input-sm" ng-model="vm.currentCustomer.userId" ng-disabled="isModify">
                            </div>
                            <div style="margin-left: 20px;" class="col-xs-2 text-left">
                                <label>客户姓名</label>
                            </div>
                            <div style="margin-left: -20px;margin-top: -8px;" class="col-xs-4">
                                <input type="text" class="form-control input-sm" ng-model="vm.currentCustomer.name">
                            </div>
                        </div>
                        <br>
                        <div class="row">
                            <div class="col-xs-2 text-left">
                                <label>账号密码</label>
                            </div>
                            <div style="margin-left: -20px;margin-top: -8px;" class="col-xs-10">
                                <input type="text" class="form-control input-sm" ng-model="vm.currentCustomer.password" onkeyup="this.value=this.value.replace(/^\s+|\s+$/g,'')">
                            </div>
                        </div>
                        <br>
                        <div class="row">
                            <div class="col-xs-2 text-left">
                                <label>客户级别</label>
                            </div>
                            <div style="margin-left: -20px;margin-top: -8px;"  class="col-xs-4">
                                <select name="customerLevel" ng-model="vm.currentCustomer.customerLevel" ng-options="customerLevel.name for customerLevel in config.customerLevels" class="form-control" ng-selected=""></select>
                            </div>
                            <div style="margin-left: 20px;" class="col-xs-2 text-left">
                                <label>联系电话</label>
                            </div>
                            <div style="margin-left: -20px;margin-top: -8px;"  class="col-xs-4">
                                <input type="text" class="form-control input-sm" ng-model="vm.currentCustomer.phone">
                            </div>
                        </div>
                        <br>
                        <div class="row">
                            <div  class="col-xs-2 text-left">
                                <label>客户类型</label>
                            </div>
                            <div style="margin-left: -20px;margin-top: -8px;"  class="col-xs-4">
                                <select name="customerType" ng-model="vm.currentCustomer.customerType" ng-options="customerType.name for customerType in config.customerTypes" class="form-control" ng-selected=""></select>
                            </div>

                            <div style="margin-left: 20px;" class="col-xs-2 text-left">
                                <label>客户公司</label>
                            </div>
                            <div style="margin-left: -20px;margin-top: -8px;" class="col-xs-4">
                                <input type="text" class="form-control  input-sm" ng-model="vm.currentCustomer.customerCompany.name">
                            </div>
                        </div>
                        <br>
                        <div class="row">
                            <div class="col-xs-2 text-left">
                                <label>身份证号</label>
                            </div>
                            <div style="margin-left: -20px;margin-top: -8px;" class="col-xs-10">
                                <input type="text" class="form-control input-sm" ng-model="vm.currentCustomer.identity">
                            </div>
                        </div>
                        <br>
                        <div class="row">
                            <div class="col-xs-2 text-left">
                                <label>客户地址</label>
                            </div>
                            <div style="margin-left: -20px;margin-top: -8px;" class="col-xs-3">
                                <select name="province" ng-model="vm.currentCustomer.address.province" ng-options="province for province in config.provinces" class="form-control" ng-selected="" ng-change="provincesChange()"></select>
                            </div>
                            <div style="margin-left: 0px;margin-top: -8px;" class="col-xs-3">
                                <select name="city" ng-model="vm.currentCustomer.address.city" ng-options="city for city in config.citys" class="form-control" ng-selected="" ng-change="citysChange()"></select>
                            </div>
                            <div style="margin-left: 0px;margin-top: -8px;" class="col-xs-4">
                                <select name="county" ng-model="vm.currentCustomer.address.county" ng-options="county for county in config.countys" class="form-control" ng-selected=""></select>
                            </div>
                        </div>
                        <br>
                        <div class="row">
                            <div class="col-xs-2 text-left">
                            </div>
                        <div style="margin-left: -20px;margin-top: -8px;" class="col-xs-10">
                            <input type="text" class="form-control input-sm" ng-model="vm.currentCustomer.address.detail">
                        </div>
                        </div>
                        <br>
                        <div class="row">
                            <div class="col-xs-2 text-left">
                                <label>客户状态</label>
                            </div>
                            <div style="margin-left: -20px;margin-top: -8px;" class="col-xs-4">
                                <select name="customerStatus" ng-model="vm.currentCustomer.status" ng-options="customerStatus.code as customerStatus.name for customerStatus in config.customerStatus" class="form-control" ng-selected=""></select>
                            </div>

                            <div style="margin-left: 20px;" class="col-xs-2 text-left">
                                <label>结算类型</label>
                            </div>
                            <div style="margin-left: -20px;margin-top: -8px;"  class="col-xs-4">
                                <select name="settlementType" ng-model="vm.currentCustomer.settlementType" ng-options="settlementType.name for settlementType in config.settlementTypes" class="form-control" ng-selected=""></select>
                            </div>

                        </div>
                        <br>
                        <div class="row">
                            <div class="col-xs-2 text-left">
                                <label>客户来源</label>
                            </div>
                            <div style="margin-left: -20px;margin-top: -8px;" class="col-xs-4">
                                <select name="customerSource" ng-model="vm.currentCustomer.customerSource" ng-options="customerSource.name for customerSource in config.customerSources" class="form-control" ng-selected=""></select>
                            </div>
                            <div style="margin-left: 20px;" class="col-xs-2 text-left">
                                <label>是否携瓶</label>

                            </div>
                            <div style="margin-left: -20px;margin-top: -8px;" class="col-xs-4">
                                <select name="haveCylinder" ng-model="vm.currentCustomer.haveCylinder" ng-options="haveCylinder.code as haveCylinder.name for haveCylinder in config.haveCylinders" class="form-control" ng-selected=""></select>
                            </div>
                        </div>
                        <br>
                        <div class="row">
                            <div  class="col-xs-2 text-left">
                                <label>客户备注</label>
                            </div>
                            <div style="margin-left: -20px;margin-top: -8px;" class="col-xs-10">
                                <input type="text" class="form-control  input-sm" ng-model="vm.currentCustomer.note">
                            </div>
                        </div>


                    </div>
                </div>
                <div class="input-group pdb15" ng-if="isModify">
                    <label class="col-sm-4 control-label input-label-large">用户卡编码：</label>
                    <div class="col-sm-8 input-width">
                        <input type="text" name="userCardNumber" class="form-control" ng-model="vm.userCard"  required>
                    </div>
                    <button ng-if="vm.isBindedUserCard" type="button" class="btn btn-sm btn-danger" ng-click="userCardunBind(vm.userCard)"><i class="fa fa-minus"></i> 解绑 </button>
                    <button ng-if="!vm.isBindedUserCard" type="button" class="btn btn-sm btn-success" ng-click="userCardbind(vm.userCard)"><i class="fa fa-plus"></i> 绑定 </button>
                </div>

                <div class="input-group pdb15" ng-if="isModify">
                    <label class="col-sm-4 control-label input-label-large">推荐人ID：</label>
                    <div class="col-sm-8 input-width">
                        <input type="text" name="developedUserId" class="form-control" ng-model="vm.currentDevelopedUserId"  required>
                    </div>
                    <!--<button ng-if="isBinded" type="button" class="btn btn-sm btn-danger" ng-click="unBind()"><i class="fa fa-plus"></i> 解绑 </button>-->
                    <button type="button" class="btn btn-sm btn-success" ng-click="developedUserBind(vm.currentDevelopedUserId)"><i class="fa fa-plus"></i> 绑定 </button>
                </div>
                <div class="input-group pdb15" ng-repeat="developedUser in vm.developedUserList" ng-if="isModify">
                    <label class="col-sm-4 control-label input-label-large">推荐人ID：</label>
                    <div class="col-sm-8 input-width">
                        <input type="text" name="developedUserId" class="form-control" ng-model="developedUser.referee.userId"  required>
                    </div>
                    <!--<button ng-if="isBinded" type="button" class="btn btn-sm btn-danger" ng-click="unBind()"><i class="fa fa-plus"></i> 解绑 </button>-->
                    <button type="button" class="btn btn-sm btn-danger" ng-click="developedUserUnBind(developedUser.referee.userId)"><i class="fa fa-minus"></i> 解绑 </button>
                </div>



                <div class="input-group pdb15" ng-if="isModify">
                    <label class="col-sm-4 control-label input-label-large">托盘编码：</label>
                    <div class="col-sm-8 input-width">
                        <input type="text" name="palletNumber" class="form-control" ng-model="vm.currentPalletNumber"  required>
                    </div>
                    <!--<button ng-if="isBinded" type="button" class="btn btn-sm btn-danger" ng-click="unBind()"><i class="fa fa-plus"></i> 解绑 </button>-->
                    <button type="button" class="btn btn-sm btn-success" ng-click="bind(vm.currentPalletNumber)"><i class="fa fa-plus"></i> 绑定 </button>
                </div>

                <div class="input-group pdb15" ng-repeat="pallet in vm.palletList" ng-if="isModify">
                    <label class="col-sm-4 control-label input-label-large">托盘编码：</label>
                    <div class="col-sm-8 input-width">
                        <input type="text" name="palletNumber" class="form-control" ng-model="pallet.number"  required>
                    </div>
                    <!--<button ng-if="isBinded" type="button" class="btn btn-sm btn-danger" ng-click="unBind()"><i class="fa fa-plus"></i> 解绑 </button>-->
                    <button type="button" class="btn btn-sm btn-danger" ng-click="unBind(pallet.number)"><i class="fa fa-minus"></i> 解绑 </button>
                </div>

                <div class="modal-footer">
                    <button type="submit" ng-click="submit(vm.currentCustomer)" class="btn btn-primary">保存</button>
                    <button type="button" ng-click="closeModal()" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
            </form>
        </div>
    </div>
</div>





